import 'package:flutter/material.dart';

class TextFieldExample extends StatefulWidget {
  @override
  _TextFieldExampleState createState() => _TextFieldExampleState();
}

class _TextFieldExampleState extends State<TextFieldExample> {
  @override
  Widget build(BuildContext context) {
    final TextEditingController textEditingController = TextEditingController();
    textEditingController.addListener(() {
      final text = textEditingController.text;
      print(text);
    });

    return Scaffold(
      appBar: AppBar(
        title: Text("TextFieldExample"),
      ),
      body: Padding(
        padding: const EdgeInsets.all(10.0),
        child: Column(
          children: [
            Theme(
              data: ThemeData(
                primaryColor: Colors.red,
                hintColor: Colors.green,
              ),
              child: TextField(
                controller: textEditingController,
                decoration: InputDecoration(
                  labelText: 'Hello',
                  border: UnderlineInputBorder(
                    borderSide: BorderSide(
                      color: Colors.red,
                    ),
                  ),
                  enabledBorder: UnderlineInputBorder(
                    borderSide: BorderSide(
                      color: Colors.red,
                    ),
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
